package com.ruoyi.framework.web.service;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.model.LoginApi;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.utils.HttpConnectUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;


@Service
public class ConnectUserServiceImpl implements ConnectUserService {

    @Override
    public String loginApi(LoginBody loginBody) {

        String toUrl = String.format("http://192.168.1.210:8601/rest/auth/login");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("username","admin");
        jsonObject.put("password","123456");
//        jsonObject.put("username",loginBody.getUsername());
//        jsonObject.put("password",loginBody.getPassword());
        String a = jsonObject.toString();

        String doPost = HttpConnectUtil.doPost(toUrl, a, "application/json;charset=utf-8", "", "");
        return doPost;
    }


    @Override
    public String checkToken(String token) {

        String toUrl = String.format("http://192.168.1.210:8601/rest/auth/verify?token=%s", token);

        String doGet = HttpConnectUtil.doGet(toUrl);
        return doGet;
    }
}
